<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title></title>
	<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
	<script type="text/javascript" src="scripts/upload_crop_required.js"></script>
</head>
<body>
<input type="button" value="点击" id="click_me"/>

<img src="" id="preview_img"/>
<input type="hidden" id="save_img_url"/>
<div class="floatwindow ie6_floatwindow"></div>
<div class="masklayer ie6_masklayer"></div>
<script type="text/javascript">
	$(function () {
		zDialog.imagePath = "../dialog/images/";
		var _opt = {
			self:$(this),
			imageUrl: "http://i.123tsg.com/",
			postUrl: "action/doAction.php",
			cropMinWidth: 100,
			cropMinHeight: 100,
			cropMaxWidth: 300,
			cropMaxHeight: 300,
			complete: {
				callback: function (_data) {
					$("#preview_img").attr({
						"src": _opt.imageUrl + _data.img + "?t=" + (new Date()).getTime(),
						"data-save": _data.img
					});
				}
			}
		};
		$("#click_me").click(function () {
			var img_src=$("#preview_img").attr("data-save");
			if(false !==UploadCrop.is_defined(img_src)){
				_opt.srcImage=img_src;
			}
			UploadCrop.init(_opt,22);
		});

	});
</script>
</body>
</html>